home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / What's New? / Development Kits / Mac OS / USB DDK 1.4.6f4 / Examples / DropPrint•USB / SafeNameRegistry.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-25  |  19.3 KB  |  601 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        SafeNameRegistry.c
  3.  
  4.     Contains:    Stub routines for name registry calls
  5.  
  6.  
  7.  
  8.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History:
  11.  
  12.         25 Mar 98     gp        Added calls to create and remove name registry proc ptrs
  13.         18 Mar 98     gp        Created
  14.  
  15.     To Do:
  16. */
  17.  
  18. #ifndef __CODEFRAGMENTS__
  19. #include <CodeFragments.h>
  20. #endif
  21.  
  22. #ifndef __MIXEDMODE__
  23. #include <MixedMode.h>
  24. #endif
  25.  
  26. #ifndef __GESTALT__
  27. #include <Gestalt.h>
  28. #endif
  29.  
  30. #ifndef __ERRORS__
  31. #include <Errors.h>
  32. #endif
  33.  
  34. #ifndef __DIALOGS__
  35. #include <Dialogs.h>
  36. #endif
  37.  
  38. #ifndef __SafeNameRegistry__
  39. #include "SafeNameRegistry.h"
  40. #endif
  41.  
  42. /******************************************************************************
  43.     Prototypes
  44.  ******************************************************************************/
  45.  
  46. // prototypes used to find address of routine in name registry library
  47. OSErr Find_Symbol(Ptr* pSymAddr, Str255 pSymName, ProcInfoType pProcInfo);
  48. pascal OSErr GetSystemArchitecture(OSType *archType);
  49.  
  50. /******************************************************************************
  51.     Typedefs
  52.  ******************************************************************************/
  53.  
  54. // proc typedefs for calling routines in the name registry library
  55. typedef pascal OSStatus (*RegistryEntryIDInitProcPtr) ( RegEntryID* id );
  56. typedef pascal OSStatus (*RegistryCStrEntryLookupProcPtr) ( RegEntryID* searchPointID, 
  57.             RegCStrPathName* pathName, RegEntryID*foundEntry );
  58. typedef pascal OSStatus (*RegistryEntryIterateCreateProcPtr) ( RegEntryIter* cookie );
  59. typedef pascal OSStatus (*RegistryEntryIterateDisposeProcPtr) ( RegEntryIter* cookie );
  60. typedef pascal OSStatus (*RegistryEntryIterateSetProcPtr) ( RegEntryIter* cookie, RegEntryID *startEntryID );
  61. typedef pascal OSStatus (*RegistryEntryIterateProcPtr) ( RegEntryIter *cookie, 
  62.             RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done );
  63. typedef pascal OSStatus (*RegistryEntryIDDisposeProcPtr) ( RegEntryID* id );
  64. typedef pascal OSStatus (*RegistryPropertyGetProcPtr) ( RegEntryID *entryID, 
  65.             RegPropertyName *propertyName, void *propertyValue, RegPropertyValueSize *propertySize );
  66.  
  67. /******************************************************************************
  68.     Constants
  69.  ******************************************************************************/
  70.  
  71. #define    kNoNameRegistryAlert        3000
  72.  
  73. // stack descriptors used in the name registry stub calls to pass params
  74. // to the proper routine in the name registry shared library
  75.  
  76. enum {
  77.     kRegistryEntryIDInitProcInfo = kPascalStackBased
  78.     | RESULT_SIZE( SIZE_CODE(sizeof(OSStatus)))
  79.     | STACK_ROUTINE_PARAMETER( 1, SIZE_CODE(sizeof( RegEntryID*)))
  80. };
  81. enum {
  82.     kRegistryCStrEntryLookupProcInfo = kPascalStackBased
  83.     | RESULT_SIZE( SIZE_CODE(sizeof(OSStatus)))
  84.     | STACK_ROUTINE_PARAMETER( 1, SIZE_CODE(sizeof( RegEntryID*)))
  85.     | STACK_ROUTINE_PARAMETER( 2, SIZE_CODE(sizeof( RegCStrPathName*)))
  86.     | STACK_ROUTINE_PARAMETER( 3, SIZE_CODE(sizeof( RegEntryID*)))
  87. };
  88. enum {
  89.     kRegistryEntryIterateCreateProcInfo = kPascalStackBased
  90.     | RESULT_SIZE( SIZE_CODE(sizeof(OSStatus)))
  91.     | STACK_ROUTINE_PARAMETER( 1, SIZE_CODE(sizeof( RegEntryIter*)))
  92. };
  93. enum {
  94.     kRegistryEntryIterateDisposeProcInfo = kPascalStackBased
  95.     | RESULT_SIZE( SIZE_CODE(sizeof(OSStatus)))
  96.     | STACK_ROUTINE_PARAMETER( 1, SIZE_CODE(sizeof( RegEntryIter*)))
  97. };
  98. enum {
  99.     kRegistryEntryIterateSetProcInfo = kPascalStackBased
  100.     | RESULT_SIZE( SIZE_CODE(sizeof(OSStatus)))
  101.     | STACK_ROUTINE_PARAMETER( 1, SIZE_CODE(sizeof( RegEntryIter*)))
  102.     | STACK_ROUTINE_PARAMETER( 2, SIZE_CODE(sizeof( RegEntryID*)))
  103. };
  104. enum {
  105.     kRegistryEntryIterateProcInfo = kPascalStackBased
  106.     | RESULT_SIZE( SIZE_CODE(sizeof(OSStatus)))
  107.     | STACK_ROUTINE_PARAMETER( 1, SIZE_CODE(sizeof( RegEntryIter*)))
  108.     | STACK_ROUTINE_PARAMETER( 2, SIZE_CODE(sizeof( RegEntryIterationOp)))
  109.     | STACK_ROUTINE_PARAMETER( 3, SIZE_CODE(sizeof( RegEntryID*)))
  110.     | STACK_ROUTINE_PARAMETER( 4, SIZE_CODE(sizeof( Boolean*)))
  111. };
  112. enum {
  113.     kRegistryEntryIDDisposeProcInfo = kPascalStackBased
  114.     | RESULT_SIZE( SIZE_CODE(sizeof(OSStatus)))
  115.     | STACK_ROUTINE_PARAMETER( 1, SIZE_CODE(sizeof( RegEntryID*)))
  116. };
  117. enum {
  118.     kRegistryPropertyGetProcInfo = kPascalStackBased
  119.     | RESULT_SIZE( SIZE_CODE(sizeof(OSStatus)))
  120.     | STACK_ROUTINE_PARAMETER( 1, SIZE_CODE(sizeof( RegEntryID*)))
  121.     | STACK_ROUTINE_PARAMETER( 2, SIZE_CODE(sizeof( RegPropertyName*)))
  122.     | STACK_ROUTINE_PARAMETER( 3, SIZE_CODE(sizeof( void*)))
  123.     | STACK_ROUTINE_PARAMETER( 4, SIZE_CODE(sizeof( RegPropertyValueSize*)))
  124. };
  125.  
  126. typedef struct
  127. {
  128. // address of name registry routines
  129.     ProcPtr        RegistryEntryIDInitAddr;
  130.     ProcPtr        RegistryCStrEntryLookupAddr;
  131.     ProcPtr        RegistryEntryIterateCreateAddr;
  132.     ProcPtr        RegistryEntryIterateDisposeAddr;
  133.     ProcPtr        RegistryEntryIterateSetAddr;
  134.     ProcPtr        RegistryEntryIterateAddr;    
  135.     ProcPtr        RegistryEntryIDDisposeAddr;    
  136.     ProcPtr        RegistryPropertyGetAddr;
  137.  
  138.     Boolean        hasNameRegistry;            // does this cpu have a name registry
  139.     Boolean        checkedForNameRegistry;        // did we check for the name registry already
  140.  
  141.     short        numberOfPrinters;            // total number of printers listed
  142.     short        numberOfUSBPrinters;        // total number of USB printers
  143.     short        numberOfPorts;                // total number of serial ports on this cpu
  144.  
  145.     Boolean        supportsSerial;                // do we support serial
  146.     Boolean        supportsUSB;                // do we support USB
  147. // holds index into our STR# rsrc (name registry model path) for each entry in the printer list
  148.     short*        modelIndex;
  149. } USBGlobals;
  150.  
  151. USBGlobals    gGlobals;
  152. /*-----------------------------------------------------------------------------*
  153.  
  154.     NameRegistryInstalled
  155.     
  156.     Desc:        Test to see if the name registry exists on this machine
  157.  
  158.     In:            None
  159.  
  160.     Out:        True if name registry exists else false
  161.     
  162.     History:
  163.  
  164.     18 Mar 98    gp        Added.
  165.     
  166. *-----------------------------------------------------------------------------*/
  167. Boolean    NameRegistryInstalled( void )
  168. {
  169.     OSErr    err=noErr;        // result from gestalt call
  170.     long    result;
  171.     // if not our first time then return previous result
  172.     if( gGlobals.checkedForNameRegistry == true )
  173.         return gGlobals.hasNameRegistry;
  174.     else {
  175.  
  176.     // check to see if name registry exists
  177.         err = Gestalt(gestaltNameRegistryVersion, &result);
  178.         if( err == noErr )
  179.             gGlobals.hasNameRegistry = true;
  180.         else {
  181.             gGlobals.hasNameRegistry = false;
  182.     // put up alert if it isn't installed
  183.             StopAlert(kNoNameRegistryAlert, nil);
  184.         }
  185.         gGlobals.checkedForNameRegistry=true;
  186.     }
  187.     return gGlobals.hasNameRegistry;
  188. }
  189.  
  190. /*-----------------------------------------------------------------------------*
  191.  
  192.     SafeRegistryEntryIDInit
  193.     
  194.     Desc:        Stub code for name registry routine 'RegistryEntryIDInit'
  195.  
  196.     In:            id - pointer to a RegEntryID to initialize
  197.  
  198.     Out:        returns any errors which may have occur
  199.     
  200.     History:
  201.  
  202.     18 Mar 98    gp        Added.
  203.     
  204. *-----------------------------------------------------------------------------*/
  205.  
  206. OSStatus SafeRegistryEntryIDInit(RegEntryID *id)
  207. {
  208.     OSStatus    anErr=-1;                // return value
  209.  
  210.     if( (Ptr) gGlobals.RegistryEntryIDInitAddr != (Ptr) nil )
  211.         anErr = ((RegistryEntryIDInitProcPtr) gGlobals.RegistryEntryIDInitAddr) (id);
  212.     return anErr;
  213. }
  214.  
  215. /*-----------------------------------------------------------------------------*
  216.  
  217.     SafeRegistryCStrEntryLookup
  218.     
  219.     Desc:        Stub code for name registry routine 'RegistryCStrEntryLookup'
  220.  
  221.     In:            searchPointID - the RegEntryID to start searching from
  222.                 pathName - the cstring path of the entry to find
  223.                 foundEntry - where to store the found entry
  224.  
  225.     Out:        foundEntry - the RegEntryID of any found entry
  226.                 returns any errors which may have occur
  227.     
  228.     History:
  229.  
  230.     18 Mar 98    gp        Added.
  231.     
  232. *-----------------------------------------------------------------------------*/
  233. OSStatus SafeRegistryCStrEntryLookup( RegEntryID *searchPointID, RegCStrPathName *pathName, RegEntryID *foundEntry)
  234. {
  235.     OSStatus    anErr=-1;                // return value
  236.     // now call it
  237.     if( (Ptr) gGlobals.RegistryCStrEntryLookupAddr != (Ptr) nil )
  238.         anErr = ((RegistryCStrEntryLookupProcPtr) gGlobals.RegistryCStrEntryLookupAddr) (searchPointID, pathName, foundEntry);
  239.     return anErr;
  240. }
  241.  
  242. /*-----------------------------------------------------------------------------*
  243.  
  244.     SafeRegistryEntryIterateCreate
  245.     
  246.     Desc:        Stub code for name registry routine 'RegistryEntryIterateCreate'
  247.  
  248.     In:            id - pointer to a RegEntryIter to initialize
  249.  
  250.     Out:        returns any errors which may have occur
  251.     
  252.     History:
  253.  
  254.     18 Mar 98    gp        Added.
  255.     
  256. *-----------------------------------------------------------------------------*/
  257. OSStatus SafeRegistryEntryIterateCreate(RegEntryIter *cookie)
  258. {
  259.     OSStatus    anErr=-1;                // return value
  260.     if( (Ptr) gGlobals.RegistryEntryIterateCreateAddr != (Ptr) nil )
  261.         anErr = ((RegistryEntryIterateCreateProcPtr) gGlobals.RegistryEntryIterateCreateAddr) (cookie);
  262.     return anErr;
  263. }
  264.  
  265. /*-----------------------------------------------------------------------------*
  266.  
  267.     SafeRegistryEntryIterateDispose
  268.     
  269.     Desc:        Stub code for name registry routine 'RegistryEntryIterateDispose'
  270.  
  271.     In:            cookie - iterator to dispose
  272.  
  273.     Out:        returns any errors which may have occur
  274.     
  275.     History:
  276.  
  277.     18 Mar 98    gp        Added.
  278.     
  279. *-----------------------------------------------------------------------------*/
  280. OSStatus SafeRegistryEntryIterateDispose(RegEntryIter *cookie)
  281. {
  282.     OSStatus    anErr=-1;                // return value
  283.     if( (Ptr) gGlobals.RegistryEntryIterateDisposeAddr != (Ptr) nil )
  284.         anErr = ((RegistryEntryIterateDisposeProcPtr) gGlobals.RegistryEntryIterateDisposeAddr) (cookie);
  285.     return anErr;
  286. }
  287.  
  288. /*-----------------------------------------------------------------------------*
  289.  
  290.     SafeRegistryEntryIterateSet
  291.     
  292.     Desc:        Stub code for name registry routine 'RegistryEntryIterateSet'
  293.  
  294.     In:            cookie - pointer to iterator to set
  295.                 startEntryID - name registry entry to start iterating from
  296.  
  297.     Out:        returns any errors which may have occur
  298.     
  299.     History:
  300.  
  301.     18 Mar 98    gp        Added.
  302.     
  303. *-----------------------------------------------------------------------------*/
  304. OSStatus SafeRegistryEntryIterateSet(RegEntryIter *cookie, RegEntryID *startEntryID)
  305. {
  306.     OSStatus    anErr=-1;                // return value
  307.     if( (Ptr) gGlobals.RegistryEntryIterateSetAddr != (Ptr) nil )
  308.         anErr = ((RegistryEntryIterateSetProcPtr) gGlobals.RegistryEntryIterateSetAddr) (cookie, startEntryID);
  309.     return anErr;
  310. }
  311.  
  312. /*-----------------------------------------------------------------------------*
  313.  
  314.     SafeRegistryEntryIterate
  315.     
  316.     Desc:        Stub code for name registry routine 'RegistryEntryIterate'
  317.  
  318.     In:            cookie - iterator to use
  319.                 relationship - direction to iterate
  320.                 foundEntry - where to store next name entry found
  321.                 done - tells if we're done with iteration
  322.  
  323.     Out:        foundEntry - RegEntryID of name entry found
  324.                 done - true if no more entries found
  325.                 returns any errors which may have occur
  326.     
  327.     History:
  328.  
  329.     18 Mar 98    gp        Added.
  330.     
  331. *-----------------------------------------------------------------------------*/
  332. OSStatus SafeRegistryEntryIterate(RegEntryIter *cookie, RegEntryIterationOp relationship, 
  333.         RegEntryID *foundEntry, Boolean *done)
  334. {
  335.     OSStatus    anErr=-1;                // return value
  336.     if( (Ptr) gGlobals.RegistryEntryIterateAddr != (Ptr) nil )
  337.         anErr = ((RegistryEntryIterateProcPtr) gGlobals.RegistryEntryIterateAddr) (cookie, relationship, foundEntry, done);
  338.     return anErr;
  339. }
  340.  
  341. /*-----------------------------------------------------------------------------*
  342.  
  343.     SafeRegistryEntryIDDispose
  344.     
  345.     Desc:        Stub code for name registry routine 'RegistryEntryIDDispose'
  346.  
  347.     In:            id - RegEntryID to dispose
  348.  
  349.     Out:        returns any errors which may have occur
  350.     
  351.     History:
  352.  
  353.     18 Mar 98    gp        Added.
  354.     
  355. *-----------------------------------------------------------------------------*/
  356. OSStatus SafeRegistryEntryIDDispose(RegEntryID *id)
  357. {
  358.     OSStatus    anErr=-1;                // return value
  359.     if( (Ptr) gGlobals.RegistryEntryIDDisposeAddr != (Ptr) nil )
  360.         anErr = ((RegistryEntryIDDisposeProcPtr) gGlobals.RegistryEntryIDDisposeAddr) (id);
  361.     return anErr;
  362. }
  363.  
  364. /*-----------------------------------------------------------------------------*
  365.  
  366.     SafeRegistryPropertyGet
  367.     
  368.     Desc:        Stub code for name registry routine 'RegistryPropertyGet'
  369.  
  370.     In:            entryID - RegEntryID value that identifies a name entry
  371.                 propertyName - name of the property
  372.                 propertyValue - buffer to hold the property
  373.                 propertySize - size of the property buffer
  374.  
  375.     Out:        propertySize - size of the property retrieved
  376.                 returns any errors which may have occur
  377.     
  378.     History:
  379.  
  380.     18 Mar 98    gp        Added.
  381.     
  382. *-----------------------------------------------------------------------------*/
  383. OSStatus SafeRegistryPropertyGet( RegEntryID *entryID, RegPropertyName *propertyName, 
  384.         void *propertyValue, RegPropertyValueSize *propertySize)
  385. {
  386.     OSStatus    anErr=-1;                // return value
  387.     if( (Ptr) gGlobals.RegistryPropertyGetAddr != (Ptr) nil )
  388.         anErr = ((RegistryPropertyGetProcPtr) gGlobals.RegistryPropertyGetAddr) (entryID, propertyName, propertyValue, propertySize);
  389.     return anErr;
  390. }
  391.  
  392. /*-----------------------------------------------------------------------------*
  393.  
  394.     GetSystemArchitecture
  395.     
  396.     Desc:        Taken from 
  397.                 DTS Technote 1077 "Calling CFM Code from Classic 68K Code".
  398.                 Returns architect of current cpu during runtime.
  399.  
  400.  
  401.     In:            archType - address of variable to hold architect type
  402.  
  403.     Out:        archType - returns architect of current cpu pointed by this variable
  404.                 Also returns any errors
  405.     
  406.     History:
  407.  
  408.     18 Mar 98    gp        Added.
  409.     
  410. *-----------------------------------------------------------------------------*/
  411.  
  412. pascal OSErr GetSystemArchitecture(OSType *archType)
  413. {
  414.     long sSysArchitecture = 0; // static so we only Gestalt once.
  415.     OSErr tOSErr = noErr;
  416.     
  417.     *archType = kAnyCFragArch;   // assume wild architecture
  418.     
  419.     // If we don't know the system architecture yet...
  420.     if (sSysArchitecture == 0)
  421.         // ...Ask Gestalt what kind of machine we are running on.
  422.         tOSErr = Gestalt(gestaltSysArchitecture, &sSysArchitecture);
  423.     
  424.     if (tOSErr == noErr) // if no errors
  425.     {
  426.         if (sSysArchitecture == gestalt68k)   // 68k?
  427.              *archType = kMotorola68KCFragArch;   
  428.         else if (sSysArchitecture == gestaltPowerPC) // PPC?
  429.              *archType = kPowerPCCFragArch;       
  430.         else
  431.              tOSErr = gestaltUnknownErr;  // who knows what might be next?
  432.     }
  433.     return tOSErr;
  434. }
  435.  
  436. /*-----------------------------------------------------------------------------*
  437.  
  438.     Find_Symbol
  439.     
  440.     Desc:        Taken from 
  441.                 DTS Technote 1077 "Calling CFM Code from Classic 68K Code".
  442.                 Returns the address of a routine in a shared library
  443.  
  444.     In:            pSymAddr - address of variable to hold returned address
  445.                 pSymName - a pstring of the name of the routine
  446.                 pProcInfo - stack descriptor for the routine
  447.  
  448.     Out:        pSymAddr - the address of the routine pointed by this variable
  449.                 Also returns any errors
  450.     
  451.     History:
  452.  
  453.     18 Mar 98    gp        Added.
  454.     
  455. *-----------------------------------------------------------------------------*/
  456.  
  457. OSErr Find_Symbol(Ptr* pSymAddr, Str255 pSymName, ProcInfoType pProcInfo)
  458. {
  459.     CFragConnectionID sCID = 0;
  460.     OSType sArchType = kAnyCFragArch;
  461.     OSErr sOSErr = noErr;
  462.     Str255 errMessage;
  463.     Ptr mainAddr;
  464.     CFragSymbolClass symClass;
  465.           ISAType tISAType;
  466.           
  467.     ProcInfoType used = pProcInfo;    // compiler warning
  468.     
  469.     if( NameRegistryInstalled() == false )
  470.         return -1;            // return general error - gp
  471.     
  472.     if (sArchType == kAnyCFragArch)  // if architecture is undefined...
  473.     {
  474.         sCID = 0;     // ...force (re)connect to library
  475.         sOSErr = GetSystemArchitecture(&sArchType); // determine architecture
  476.         if (sOSErr != noErr)
  477.              return sOSErr; // OOPS!
  478.     }
  479.     
  480.     if (sArchType == kMotorola68KCFragArch) // ...for CFM68K
  481.           tISAType = kM68kISA | kCFM68kRTA;
  482.     else if (sArchType == kPowerPCCFragArch)  // ...for PPC CFM
  483.           tISAType = kPowerPCISA | kPowerPCRTA;
  484.     else
  485.         sOSErr = gestaltUnknownErr; // who knows what might be next?
  486.     
  487.     if (sCID == 0) // If we haven't connected to the library yet...
  488.     {
  489.         // NOTE: The library name is hard coded here.
  490.         // I try to isolate the glue code, one file per library.
  491.         // I have had developers pass in the Library name to allow
  492.         // plug-in type support. Additional code has to be added to
  493.         // each entry points glue routine to support multiple or
  494.         // switching connection IDs.
  495.         sOSErr = GetSharedLibrary("\pNameRegistryLib", sArchType, kLoadCFrag,
  496.                    &sCID, &mainAddr, errMessage);
  497.         if (sOSErr != noErr)
  498.              return sOSErr; // OOPS!
  499.     }
  500.     
  501.     // If we haven't looked up this symbol yet...
  502.     if ((Ptr) *pSymAddr == (Ptr) kUnresolvedCFragSymbolAddress)    
  503.     {
  504.         // ...look it up now
  505.         sOSErr = FindSymbol(sCID,pSymName,pSymAddr,&symClass);
  506.         if (sOSErr != noErr) {// in case of error...
  507.          // ...clear the procedure pointer
  508.              *(Ptr*) &pSymAddr = (Ptr) kUnresolvedCFragSymbolAddress;
  509.         }
  510.         #if !GENERATINGCFM // if this is classic 68k code...
  511.          *pSymAddr = (Ptr)NewRoutineDescriptorTrap((ProcPtr) *pSymAddr,
  512.                       pProcInfo, tISAType);  // ...create a routine descriptor...
  513.         #endif
  514.     }
  515.     return sOSErr;
  516. }
  517.  
  518. /*-----------------------------------------------------------------------------*
  519.  
  520.     InitNameRegistryPtrs
  521.     
  522.     Desc:        Create all the proc ptrs to Name Registry calls we will
  523.                 need
  524.  
  525.     In:            None
  526.  
  527.     Out:        None
  528.     
  529.     History:
  530.  
  531.     25 Mar 98    gp        Created
  532.     
  533. *-----------------------------------------------------------------------------*/
  534. void    InitNameRegistryPtrs( void )
  535. {
  536.     OSStatus    anErr=noErr;                // error code for Find_Symbol and name registry call
  537.  
  538.     if( NameRegistryInstalled() == true) {
  539.         anErr = Find_Symbol( (Ptr*) &gGlobals.RegistryEntryIDInitAddr, 
  540.                 "\pRegistryEntryIDInit", kRegistryEntryIDInitProcInfo );
  541.         anErr = Find_Symbol( (Ptr*) &gGlobals.RegistryCStrEntryLookupAddr, 
  542.                 "\pRegistryCStrEntryLookup", kRegistryCStrEntryLookupProcInfo );
  543.         anErr = Find_Symbol( (Ptr*) &gGlobals.RegistryEntryIterateCreateAddr, 
  544.                 "\pRegistryEntryIterateCreate", kRegistryEntryIterateCreateProcInfo );
  545.         anErr = Find_Symbol( (Ptr*) &gGlobals.RegistryEntryIterateDisposeAddr, 
  546.                 "\pRegistryEntryIterateDispose", kRegistryEntryIterateDisposeProcInfo );
  547.         anErr = Find_Symbol( (Ptr*) &gGlobals.RegistryEntryIterateSetAddr, 
  548.                 "\pRegistryEntryIterateSet", kRegistryEntryIterateSetProcInfo );
  549.         anErr = Find_Symbol( (Ptr*) &gGlobals.RegistryEntryIterateAddr, 
  550.                 "\pRegistryEntryIterate", kRegistryEntryIterateProcInfo );
  551.         anErr = Find_Symbol( (Ptr*) &gGlobals.RegistryEntryIDDisposeAddr, 
  552.                 "\pRegistryEntryIDDispose", kRegistryEntryIDDisposeProcInfo );
  553.         anErr = Find_Symbol( (Ptr*) &gGlobals.RegistryPropertyGetAddr, 
  554.                 "\pRegistryPropertyGet", kRegistryPropertyGetProcInfo );
  555.     }
  556. }
  557.  
  558. /*-----------------------------------------------------------------------------*
  559.  
  560.     RemoveNameRegistryPtrs
  561.     
  562.     Desc:        Remove all the proc ptrs we created for Name Registry calls
  563.  
  564.     In:            None
  565.  
  566.     Out:        None
  567.     
  568.     History:
  569.  
  570.     25 Mar 98    gp        Created
  571.     
  572. *-----------------------------------------------------------------------------*/
  573. void    RemoveNameRegistryPtrs(void)
  574. {
  575.         // dispose of proc ptrs
  576.         
  577.     if( gGlobals.RegistryEntryIDInitAddr != nil )
  578.         DisposeRoutineDescriptor( (struct RoutineDescriptor *) gGlobals.RegistryEntryIDInitAddr);
  579.     
  580.     if( gGlobals.RegistryCStrEntryLookupAddr != nil )
  581.         DisposeRoutineDescriptor( (struct RoutineDescriptor *) gGlobals.RegistryCStrEntryLookupAddr);
  582.     
  583.     if( gGlobals.RegistryEntryIterateCreateAddr != nil )
  584.         DisposeRoutineDescriptor( (struct RoutineDescriptor *) gGlobals.RegistryEntryIterateCreateAddr);
  585.     
  586.     if( gGlobals.RegistryEntryIterateDisposeAddr != nil )
  587.         DisposeRoutineDescriptor( (struct RoutineDescriptor *) gGlobals.RegistryEntryIterateDisposeAddr);
  588.     
  589.     if( gGlobals.RegistryEntryIterateSetAddr != nil )
  590.         DisposeRoutineDescriptor( (struct RoutineDescriptor *) gGlobals.RegistryEntryIterateSetAddr);
  591.     
  592.     if( gGlobals.RegistryEntryIterateAddr != nil )
  593.         DisposeRoutineDescriptor( (struct RoutineDescriptor *) gGlobals.RegistryEntryIterateAddr);
  594.     
  595.     if( gGlobals.RegistryEntryIDDisposeAddr != nil )
  596.         DisposeRoutineDescriptor( (struct RoutineDescriptor *) gGlobals.RegistryEntryIDDisposeAddr);
  597.     
  598.     if( gGlobals.RegistryPropertyGetAddr != nil )
  599.         DisposeRoutineDescriptor( (struct RoutineDescriptor *) gGlobals.RegistryPropertyGetAddr);
  600. }
  601.